var vm = new Vue({
	el: '#app',
	data: {
		hid:'',
		isActive:'false',
		normal:'true',
		depart1Active:[{
			active:false
		},
		{
			active:false
		}],
		depart1:[],
		depart2: [{
			name: '内分泌'

		}, {
			name: '神经'
		}]
		

	},
	methods: {
 
		getHid:function(){
			
		},
        test:function(){
        //	alert("aaa"+document.documentElement.clientHeight);
        },
        initDc:function(){
        	var myhid=document.getElementsByClassName("hospitalId")[0].value;
			
        	var self=this;
        	self.depart1=[];
        	self.depart1Active=[];
        	self.hid=myhid;
        	alert("hid:"+self.hid);
        	axios({
        		method:'post',
        		url:'DepartmentList',
        		params:{hid:self.hid},
        		dataType:'json'
        	}).then(resp=>{
        		for(var i=0,len=resp.data.bigDepartmentsList.length;i<len;i++)
        		{
        			var selData=resp.data.bigDepartmentsList[i];
        			self.depart1.push(selData);
        			
        			self.depart1Active.push("{active:false}");
        		}
        	}).catch(resp=>{
        		alert("error");
        	})
        },
        dcSelect:function(k)
        {
        	var self=this;
        	for(var i=0;i<this.depart1.length;i++)
        	{
        		this.depart1[i].active=false;
        	}
        	this.depart1[k].active=true;
        	
        	var depart1_select=this.depart1[k].id;
        	axios({
        		method:'post',
        		url:'DepartmentList',
        		params:{hid:0,did:depart1_select},
        		dataType:'json'
        	}).then(resp=>{
        		console.log(resp.data.bigDepartmentsList.length);
        		self.depart2=[];
        		for(var i=0,len=resp.data.bigDepartmentsList.length;i<len;i++)
        		{
        			var selData=resp.data.bigDepartmentsList[i];
        			console.log("i="+selData);
        			
        			//更行部分信息到數組
        			var depart2name=resp.data.bigDepartmentsList[i].name;
        			self.depart2.push(selData);
        			
        		}
        		
        	}).catch(resp=>{
    			alert("error");
    		})
        	
        }
	}

});

document.getElementsByClassName("initDc")[0].click();
			
			
		
var vm=new Vue({
	el:'#department-container',
	data:{
		depaetmentClassify1:[
		  {name:"内科"},
		  {name:"外科"}
		],
		depaetmentClassify2:[
		{name:"内分泌"},
		{name:"心血管"}
		]
	},
	methods:{
		
	}
	
})